package fr.ants.view.renderer.pokemon;

import java.awt.Graphics2D;
import java.awt.Image;
import java.io.IOException;

import javax.imageio.ImageIO;

import fr.ants.model.Nest;
import fr.ants.view.panel.Canvas;
import fr.ants.view.renderer.NestRenderer;

/**
 * <p>Renders a nest with an image from Pokemon.</p> 
 *
 * @author Vianney DUPOY DE GUITARD
 */
public class NestPokemonRenderer implements NestRenderer {

	/** The image representing the nest. */
	private Image nestImg;

	/** Default constructor, loads the image. */
	public NestPokemonRenderer() {
		try {
			nestImg = ImageIO.read(getClass().getResourceAsStream("/draw/poke/nest.png"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	/** {@inheritDoc} */
	public void draw(int x, int y, Graphics2D g, Nest nest) {
		g.drawImage(nestImg, x * Canvas.NODE_SIZE, y * Canvas.NODE_SIZE, Canvas.NODE_SIZE, Canvas.NODE_SIZE, null);
	}
}